fix: stabilize NonBalancingIntegrationSpec to avoid port-reuse flakiness#651
Merged
He-Pin merged 1 commit intoapache:mainfrom Mar 8, 2026
Merged
Conversation
Port upstream akka/akka-grpc@93c78cd4. Add a 250ms sleep after server termination to allow unbind to fully complete before restarting on the same port. Also simplify the second connection wait to use futureValue with explicit timeout, removing the Netty-specific flakiness workaround. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Member
|
akka/akka-grpc#1742 is Apache licensed now - see #642 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
NonBalancingIntegrationSpecwas intermittently failing in CI. After callingserver1.terminate(), the OS did not always fully release the port before the test tried to restart a server on the same port. Additionally, a Netty-backend-specificisInstanceOfworkaround masked the real failure and degraded test quality by marking the test aspendinginstead of asserting correctly.Modification
Thread.sleep(250)afterserver1.terminate(5.seconds).futureValueto give the OS time to complete the unbind before restarting the server on the same portAwait.ready(replies, 15.seconds)+isInstanceOf[NonBalancingIntegrationSpecNetty]workaround with a cleanFuture.sequence(...).futureValue(timeout(15.seconds))and an unconditional direct assertionResult
The test is more stable across all backends (both Netty and Pekko HTTP) without special-casing per implementation, and the assertion is more meaningful.
References